<?
@ session_start();

include_once("class.lib/db.class.php");
include_once("class.lib/user.class.php");
//include_once("class.lib/diplome.class.php");
//include_once("class.lib/cours.class.php");
include_once("class.lib/domaine.class.php");
include_once("class.lib/mention.class.php");
include_once("class.lib/aa_niveau.class.php");
include_once("class.lib/aa_projet.class.php");
include_once("class.lib/grade.class.php");

if(isset($_GET['id_ue'])){
	$code_ue=$_GET['id_ue'];
}else{
	$code_ue=$_SESSION['code'];
}


?>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />



<script>
function addpartenaire(){
	
$("#formID").validationEngine();

	$.ajax(
		{
			type:"POST",
			url: "partenaire.add.action.php",  
			data: "nom="+$("input[name=nom]").val()+"&prenom="+
			$("input[name=prenom]").val()+
			"&email="+$("input[name=email]").val()+
			"&grade="+$("input[name=grade]").val()+
			"&specialite="+$("input[name=specialite]").val()+
			"&id_ue="+$("input[name=id_ue]").val()+
			"&Adresse="+$("input[name=Adresse]").val()+
			"&Ville="+$("input[name=Ville]").val()+
			"&CodePostal="+$("input[name=CodePostal]").val()+
			"&NumMobile="+$("input[name=NumMobile]").val()+
			"&NumFax="+$("input[name=NumFax]").val()+
			"&WebSite="+$("input[name=WebSite]").val()+
			"&tel="+$("input[name=tel]").val(),
			beforeSend: function(xhr){
				
            //    $("#message").html("<img src='../../images/loading_16X16.gif'/>");
            },
			success : function (data) {
			//alert(data);
			//$("#ajout").html("");
			load_page('addpartenaire.php?id_ue=<? echo $code_ue;?>','ajout');
			load_page('listpartenaire.php?id_ue=<? echo $code_ue;?>','listcoconcepteur');
			}
		}
	);
}
</script>
<form id="addcoconcepteur" action="">

<table>
	
  <tr align="left"> 
                  <td colspan="3"> <strong><img src="images/navi_arerow.gif" width="6" height="21" align="absmiddle" /> 
                  Le partenaire du projet est  :</strong></td>
  </tr>
				
	<tr>
<td></td><td><input class="validate[required,custom[onlyLetter],length[0,100]] text-input" name="specialite"></td>
</tr>

            <tr align="left"> 
                  <td colspan="3"> <strong><img src="images/navi_arerow.gif" width="6" height="21" align="absmiddle" /> 
                   Le repr&eacute;sentant l&eacute;gal :</strong></td>
                </tr>
				
<tr>
<td>Nom</td><td><input class="validate[required,custom[onlyLetter],length[0,100]] text-input" name="nom"></td>
</tr>

<tr>
<td>Pr&eacute;nom</td><td><input class="validate[required,custom[onlyLetter],length[0,100]] text-input" name="prenom"></td>
</tr>


<tr>
<td>Fonction</td><td>

<input class="validate[required] text-input" name="grade" id="grade" value=""/>

	<!--<select class="validate[required]" name="grade" id="grade" maxlength="50">
					<option value="">Choisissez votre fonction</option>
					<?php 
		          $grade = new Grade();
                  $g=$grade->getAllGrade();
				  // Liste des grades
                 while (list($clef,$valeur)=each($g)) 
				     {  if($valeur[0]<10) $valeur[0]="0".$valeur[0];
						echo "<OPTION value=".$valeur[0].">$valeur[2]</OPTION>";
                     }
		        ?>
	</select>
	-->
				</td>
</tr>

 <tr align="left"> 
                  <td colspan="3"> <strong><img src="images/navi_arerow.gif" width="6" height="21" align="absmiddle" /> 
Coordonn&eacute;es :</strong></td>
                </tr>

<tr>
<td>Adresse :</td><td><input class="validate[required] text-input"  name="Adresse"></td>
</tr>
<tr>
<td>Code postal :</td><td><input class="validate[required] text-input"  name="CodePostal"></td>
</tr>

<tr>
<td>Ville :</td><td><input class="validate[required] text-input"  name="Ville"></td>
</tr>

<tr>
<td>Tel:</td><td><input class="validate[required,custom[telephone]] text-input"  name="tel"></td>
</tr>

<tr>
<td>GSM :</td><td><input name="NumMobile" class="validate[required,custom[telephone]] text-input"></td>
</tr>
			
<tr>
<td>Fax :</td><td><input name="NumFax" class="validate[required,custom[telephone]] text-input"></td>
</tr>
			
<tr>
<td>Email</td><td><input name="email" class="validate[required,custom[email]] text-input"></td>
</tr>

<tr>
<td>Site Web</td><td><input name="WebSite" class="validate[required,custom[url]] text-input"></td>
</tr>




<tr>
<td><input type="button" value="Annuler" onclick="reset_page('ajout');" class="button"></td>
<td>
<?
 
	// R�cup�ation de l'id du cours en quesition
	 $projet = new Projet();
	 $id_ue = $projet->getProjetBySession(session_id());
	 //echo $id_ue;


  
?>
<input name="id_ue" value="<?php echo $code_ue;?>" type="hidden">
<input type="button" value="Enregistrer" onclick="addpartenaire();" class="button"></td>
</tr>

</table>



</form>